<template>
  <teleport to='body'>
    <DynamicChart v-if="showChart"/>
  </teleport>
  <button @click="showChart=!showChart">点击{{showChart?'关闭':'开启'}}</button>
</template>

<script>

import {
  ref
} from "vue";
import DynamicChart from './components/DynamicChart.vue';
export default {
  components: {
    DynamicChart,
  },
  setup() {
    let showChart = ref(false);
    return {
      showChart,
    };
  },
};
</script>

<style lang="less" scoped>
.demo {
  width: 1000px;
  height: 600px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
</style>